﻿using System;

namespace SW.Lite.Model
{
    [Serializable]
    public class FieldModel : IModel
    {
        /// <summary>
        /// </summary>
        public FieldModel()
        {
        }

        /// <summary>
        /// </summary>
        /// <param name="id">ID</param>
        /// <param name="modelID">模型ID</param>
        /// <param name="code">编码</param>
        /// <param name="title">标题</param>
        /// <param name="type">字段类型</param>
        /// <param name="length">长度</param>
        /// <param name="codeTable">代码表</param>
        public FieldModel(int id, int modelID, string code, string title, int type, int length, string codeTable)
        {
            Id = id;
            ModelID = modelID;
            Code = code;
            Title = title;
            Type = type;
            Length = length;
            CodeTable = codeTable;
        }

        #region 属性

        /// <summary>
        ///     ID
        /// </summary>
        public int Id { get; set; }


        /// <summary>
        ///     模型ID
        /// </summary>
        public int ModelID { get; set; }


        /// <summary>
        ///     编码
        /// </summary>
        public string Code { get; set; }


        /// <summary>
        ///     标题
        /// </summary>
        public string Title { get; set; }


        /// <summary>
        ///     字段类型
        /// </summary>
        public int Type { get; set; }


        /// <summary>
        ///     长度
        /// </summary>
        public int Length { get; set; }


        /// <summary>
        ///     代码表
        /// </summary>
        public string CodeTable { get; set; }

        #endregion
    }

    public enum FieldType
    {
        /// <summary>
        /// The text
        /// </summary>
        Text = 0,
        /// <summary>
        /// The int
        /// </summary>
        Int = 1,
        /// <summary>
        /// The boolean
        /// </summary>
        Boolean = 2,
        /// <summary>
        /// The float
        /// </summary>
        Float = 3,
        /// <summary>
        /// The date time
        /// </summary>
        DateTime = 4,

        /// <summary>
        /// The code table
        /// </summary>
        CodeTable = 5
    }
}